Skip to content

chore: simplify puppeteer install#229

Open
chenjiahan wants to merge 7 commits into
mainfrom
chenjiahan/simplify-puppeteer-install
Open

chore: simplify puppeteer install#229
chenjiahan wants to merge 7 commits into
mainfrom
chenjiahan/simplify-puppeteer-install

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

This PR removes the custom Puppeteer browser installation script introduced while recovering CI and returns CI to the official Puppeteer install path. pnpm-workspace.yaml already allows the puppeteer build script, so pnpm install can download Puppeteer's matching Chrome for Testing instead of relying on system Chrome paths or a cache repair script.

Related Links

Copilot AI review requested due to automatic review settings June 4, 2026 03:09
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9a83771b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/test.yml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the project’s Puppeteer/Chrome setup by removing the custom “repair + install” browser script and letting Puppeteer’s official installation flow handle downloading the matching Chrome for Testing binary during pnpm install. This reduces CI-specific complexity and aligns the repo with Puppeteer’s documented install path.

Changes:

  • Removed the custom Puppeteer browser installation script.
  • Simplified pnpm run test by dropping the explicit test:install step.
  • Updated the GitHub Actions test workflow to stop forcing system Chrome paths and to allow Puppeteer’s default download behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
scripts/install-puppeteer-browser.mjs Removes the bespoke cache-repair + CLI-driven browser installation logic.
package.json Drops test:install and relies on Puppeteer’s standard install-time browser download.
.github/workflows/test.yml Removes Puppeteer skip-download/system-Chrome env configuration and simplifies the OS matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 8, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 997b0640-28a5-44b6-8b53-15e93573937a

📥 Commits

Reviewing files that changed from the base of the PR and between 5d91588 and e40f838.

📒 Files selected for processing (1)
  • .github/workflows/test.yml

📝 Walkthrough

Walkthrough

Adds cancel-in-progress: true to the test job’s concurrency in .github/workflows/test.yml. Updates package.json’s scripts.test to run only pnpm run test:type && rstest and removes the test:install script. Also removes the scripts/install-puppeteer-browser.mjs implementation.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: simplify puppeteer install' accurately and concisely describes the main change—removing the custom Puppeteer installation script and simplifying the setup process.
Description check ✅ Passed The description clearly explains the purpose of the changes: removing the custom Puppeteer browser installation script and relying on the official Puppeteer install path via pnpm, with helpful context about related decisions and documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chenjiahan/simplify-puppeteer-install

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/test.yml (1)

46-52: ⚠️ Potential issue | 🟡 Minor

Align PR description with CI behavior for Puppeteer/Chrome installation

  • pnpm-workspace.yaml allows Puppeteer builds (allowBuilds.puppeteer: true), but .github/workflows/test.yml runs pnpm install with PUPPETEER_SKIP_DOWNLOAD: true (in both test and check jobs).
  • Chrome is installed only later in the test job via pnpm exec puppeteer browsers install chrome, so the PR description claiming pnpm install downloads the matching Chrome doesn’t match the current workflow.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 46 - 52, Update the PR description
to accurately reflect CI behavior: note that the "Install Dependencies" step
sets PUPPETEER_SKIP_DOWNLOAD: true so pnpm install does not download Chrome, and
that Chrome is installed later by the "Install Chrome" step which runs `pnpm
exec puppeteer browsers install chrome`; reference the step names ("Install
Dependencies" and "Install Chrome") so the description matches
.github/workflows/test.yml instead of claiming pnpm install downloads the
matching Chrome.
🧹 Nitpick comments (1)
.github/workflows/test.yml (1)

54-56: 💤 Low value

Consider breaking the verification script into multiple lines for readability.

The Node script on line 55 is quite long and hard to read. Consider using a multi-line format or extracting it to a helper script file.

♻️ Suggested improvement for readability
       - name: Verify Chrome
-        run: node -e "const fs = require('node:fs'); const puppeteer = require('puppeteer'); const executablePath = puppeteer.executablePath(); fs.accessSync(executablePath); console.log(executablePath);"
+        run: |
+          node -e "
+            const fs = require('node:fs');
+            const puppeteer = require('puppeteer');
+            const executablePath = puppeteer.executablePath();
+            fs.accessSync(executablePath);
+            console.log(executablePath);
+          "
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 54 - 56, The "Verify Chrome" GH
Actions step embeds a long single-line Node command that hurts readability;
refactor the step by replacing the inline one-liner with either a multi-line run
block using a heredoc or by extracting the script to a helper file (e.g.,
scripts/verify-chrome.js) and invoking node on it; locate the step titled
"Verify Chrome" and update the run content that currently calls
puppeteer.executablePath(), fs.accessSync and console.log to a clearer
multi-line script or external file and ensure the step still calls node with the
new script path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/test.yml:
- Around line 46-52: Update the PR description to accurately reflect CI
behavior: note that the "Install Dependencies" step sets
PUPPETEER_SKIP_DOWNLOAD: true so pnpm install does not download Chrome, and that
Chrome is installed later by the "Install Chrome" step which runs `pnpm exec
puppeteer browsers install chrome`; reference the step names ("Install
Dependencies" and "Install Chrome") so the description matches
.github/workflows/test.yml instead of claiming pnpm install downloads the
matching Chrome.

---

Nitpick comments:
In @.github/workflows/test.yml:
- Around line 54-56: The "Verify Chrome" GH Actions step embeds a long
single-line Node command that hurts readability; refactor the step by replacing
the inline one-liner with either a multi-line run block using a heredoc or by
extracting the script to a helper file (e.g., scripts/verify-chrome.js) and
invoking node on it; locate the step titled "Verify Chrome" and update the run
content that currently calls puppeteer.executablePath(), fs.accessSync and
console.log to a clearer multi-line script or external file and ensure the step
still calls node with the new script path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 42e7497a-ed41-4ec6-8c53-d80cf8f43bb7

📥 Commits

Reviewing files that changed from the base of the PR and between 2bfbba1 and f11e003.

📒 Files selected for processing (1)
  • .github/workflows/test.yml

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Around line 26-30: The workflow hardcodes puppeteer-executable-path and
exports PUPPETEER_EXECUTABLE_PATH while tests call puppeteer.launch() (relying
on that env var) and PUPPETEER_SKIP_DOWNLOAD is true, which is fragile across
runners; update .github/workflows/test.yml to install or locate Chrome via a
setup action (e.g., browser-actions/setup-chrome or step-security/setup-chrome)
before tests, capture the action output (chrome-path) and set
PUPPETEER_EXECUTABLE_PATH from that output instead of hardcoding, or add a step
that dynamically discovers the Chrome binary and exports
PUPPETEER_EXECUTABLE_PATH so puppeteer.launch() finds a valid executable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 997b0640-28a5-44b6-8b53-15e93573937a

📥 Commits

Reviewing files that changed from the base of the PR and between 5d91588 and e40f838.

📒 Files selected for processing (1)
  • .github/workflows/test.yml

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Around line 26-30: The workflow hardcodes puppeteer-executable-path and
exports PUPPETEER_EXECUTABLE_PATH while tests call puppeteer.launch() (relying
on that env var) and PUPPETEER_SKIP_DOWNLOAD is true, which is fragile across
runners; update .github/workflows/test.yml to install or locate Chrome via a
setup action (e.g., browser-actions/setup-chrome or step-security/setup-chrome)
before tests, capture the action output (chrome-path) and set
PUPPETEER_EXECUTABLE_PATH from that output instead of hardcoding, or add a step
that dynamically discovers the Chrome binary and exports
PUPPETEER_EXECUTABLE_PATH so puppeteer.launch() finds a valid executable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 997b0640-28a5-44b6-8b53-15e93573937a

📥 Commits

Reviewing files that changed from the base of the PR and between 5d91588 and e40f838.

📒 Files selected for processing (1)
  • .github/workflows/test.yml
🛑 Comments failed to post (1)
.github/workflows/test.yml (1)

26-30: ⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the specified Chrome paths would exist on GitHub runners
# This helps validate the assumption about Chrome installation locations

echo "=== Checking for Chrome/Chromium installation documentation ==="
echo "Note: This check runs in the CodeRabbit sandbox, not on actual GitHub runners"
echo ""
echo "For Ubuntu runners, common Chrome paths:"
echo "  - /usr/bin/google-chrome"
echo "  - /usr/bin/chromium-browser"
echo ""
echo "For Windows runners, common Chrome paths:"
echo "  - C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
echo "  - C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"

Repository: rstackjs/rspack-dev-server

Length of output: 476


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the workflow file
ls -la .github/workflows/test.yml

# Show the relevant section around lines 26-30 with a bit of context
nl -ba .github/workflows/test.yml | sed -n '1,120p'

Repository: rstackjs/rspack-dev-server

Length of output: 207


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- Workflow: .github/workflows/test.yml (with line numbers) ----"
# Use cat -n since nl isn't available
cat -n .github/workflows/test.yml | sed -n '1,120p'
echo "---- tail ----"
cat -n .github/workflows/test.yml | tail -n 60

Repository: rstackjs/rspack-dev-server

Length of output: 4935


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Search where Puppeteer executable path is read/used
rg -n "PUPPETEER_EXECUTABLE_PATH|executablePath|PUPPETEER_SKIP_DOWNLOAD" -S .

Repository: rstackjs/rspack-dev-server

Length of output: 52


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "puppeteer" -S .

Repository: rstackjs/rspack-dev-server

Length of output: 1620


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- tests/helpers/run-browser.js ----"
sed -n '1,120p' tests/helpers/run-browser.js
echo
echo "---- tests/helpers/puppeteer-constants.js ----"
sed -n '1,200p' tests/helpers/puppeteer-constants.js

Repository: rstackjs/rspack-dev-server

Length of output: 3775


🌐 Web query:

Puppeteer PUPPETEER_EXECUTABLE_PATH environment variable usage

💡 Result:

The PUPPETEER_EXECUTABLE_PATH environment variable is used to override the default browser executable that Puppeteer launches [1]. By setting this variable, you can instruct Puppeteer to use a specific Chrome, Chromium, or other browser installation instead of the one it automatically downloads and manages [2][3]. Key points regarding its usage: - Functionality: When set, this variable provides the default value for the executablePath option in puppeteer.launch if no explicit path is provided in the configuration object [1][4]. - Configuration Priority: Environment variables generally override settings defined in Puppeteer configuration files [2]. - Important Warning: Puppeteer is only guaranteed to work with the specific version of the browser it bundles [5][4]. Using a custom executable via PUPPETEER_EXECUTABLE_PATH is supported but is used at your own risk, as API incompatibilities may occur [5][3]. - Common Use Case: This variable is frequently used in Docker environments or CI/CD pipelines where a pre-installed browser (like a system-level chromium-browser package) is already present, allowing users to skip the Puppeteer browser download process entirely (often paired with PUPPETEER_SKIP_DOWNLOAD=true) [6]. You can set this variable in your shell or environment: export PUPPETEER_EXECUTABLE_PATH=/path/to/your/browser/executable [3] Note: Puppeteer-core ignores environment variables, so this specific variable will not have an effect when using that package [2].

Citations:


🌐 Web query:

GitHub Actions ubuntu-latest path /usr/bin/google-chrome

💡 Result:

On the standard GitHub Actions ubuntu-latest runner image, Google Chrome is pre-installed at /usr/bin/google-chrome [1]. Key points regarding Google Chrome and its path in GitHub Actions: 1. Default Installation: The standard GitHub-hosted Ubuntu runner image comes with Google Chrome pre-installed as part of its software suite [2][3]. The executable is typically located at /usr/bin/google-chrome, which is a symbolic link managed by the system's update-alternatives [1]. 2. Environment Variables: You can often reference the path using the CHROME_BIN environment variable, which is frequently used by testing frameworks to locate the browser [1][4]. 3. Version Management: While the runner comes with a default version, it is updated periodically with the runner image itself [2][5]. Because these updates are controlled by GitHub and can occasionally introduce regressions or changes, many production workflows pin their Chrome version using actions like browser-actions/setup-chrome to ensure consistency [4][3]. 4. Troubleshooting: If you need a specific version, or if you encounter issues with the pre-installed system browser, it is standard practice to use a setup action. These actions will install the desired version of Chrome and provide an output variable (often named chrome-path) to tell your workflow exactly where the new binary is located, ensuring you do not accidentally target the default /usr/bin/google-chrome [6][4][3].

Citations:


🌐 Web query:

GitHub Actions windows-latest path C:\Program Files\Google\Chrome\Application\chrome.exe

💡 Result:

On GitHub Actions windows-latest runners, there is no guaranteed or static path for chrome.exe [1][2]. While Google Chrome is pre-installed on these images, relying on a hardcoded path like C:\Program Files\Google\Chrome\Application\chrome.exe is considered bad practice because the installation directory and the existence of the browser on the runner image are subject to change by GitHub [1][3]. To reliably use Chrome in a GitHub Actions workflow, it is recommended to use a dedicated action to set up the browser, which ensures the correct version is installed and provides the exact binary path [4][5]. Recommended Approaches: 1. Use a Setup Action (Recommended): Use actions like browser-actions/setup-chrome or step-security/setup-chrome. These actions handle the installation and provide an output variable for the executable path [4][3][5]. Example using step-security/setup-chrome: steps: - uses: step-security/setup-chrome@v2 id: setup-chrome - run: | ${{ steps.setup-chrome.outputs.chrome-path }} --version 2. Locating the Binary (If Pre-installed): If you must use the pre-installed version, avoid hardcoding paths. You can locate the executable dynamically using PowerShell within your workflow: run: | $chromePath = Get-ChildItem -Path "C:\Program Files\Google\Chrome\Application\chrome.exe" -ErrorAction SilentlyContinue if ($chromePath) { & $chromePath.FullName --version } else { Write-Error "Chrome not found at expected path." } Note: GitHub maintains the runner-images repository where software on windows-latest is defined [6][7]. As of mid-2026, these runners include Google Chrome, but installation details are managed via automation scripts and can vary based on image updates [8][2]. Always refer to the official runner-images documentation or rely on setup actions for stability [4][6].

Citations:


Harden Chrome executable path setup for Puppeteer in CI

In .github/workflows/test.yml (lines 26-35), the workflow hardcodes puppeteer-executable-path and sets PUPPETEER_EXECUTABLE_PATH, but the test code calls puppeteer.launch() without an executablePath, so it relies on that env var. Since PUPPETEER_SKIP_DOWNLOAD: true, a moved/nonexistent Chrome binary will break tests.

  • Ubuntu/runner updates can still relocate Chrome (/usr/bin/google-chrome is not guaranteed forever).
  • windows-latest does not have a stable, guaranteed Chrome path, so the hardcoded C:\Program Files\Google\Chrome\Application\chrome.exe is fragile.
  • Add a Chrome setup step (e.g., browser-actions/setup-chrome / step-security/setup-chrome) and set PUPPETEER_EXECUTABLE_PATH from the action’s chrome-path output, or dynamically locate Chrome before running tests.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 26 - 30, The workflow hardcodes
puppeteer-executable-path and exports PUPPETEER_EXECUTABLE_PATH while tests call
puppeteer.launch() (relying on that env var) and PUPPETEER_SKIP_DOWNLOAD is
true, which is fragile across runners; update .github/workflows/test.yml to
install or locate Chrome via a setup action (e.g., browser-actions/setup-chrome
or step-security/setup-chrome) before tests, capture the action output
(chrome-path) and set PUPPETEER_EXECUTABLE_PATH from that output instead of
hardcoding, or add a step that dynamically discovers the Chrome binary and
exports PUPPETEER_EXECUTABLE_PATH so puppeteer.launch() finds a valid
executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants